package com.lf.service.impl;

        import com.lf.mapper.NewsMapper;
import com.lf.model.EbNews;
import com.lf.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsServiceImpl implements NewsService {

    @Autowired
    private NewsMapper newsMapper;
    @Override
    public List<EbNews> list (int page, int pageSize){
        return newsMapper.findByPage((page-1)*pageSize,pageSize);
    }

    @Override
    public int getMaxPage(int pageSize) {
        return newsMapper.getMaxPage(pageSize);
    }

    @Override
    public int save(EbNews ebNews){
        return newsMapper.save(ebNews);
    }

    @Override
    public EbNews selectByCondition(Integer enId){
        return newsMapper.findById(enId);

    }

    @Override
    public int updateById(EbNews ebNews){
        return newsMapper.updateByPk(ebNews);
    }
@Override
    public  int delete(Integer id){
        return newsMapper.delete(id);
}

}
